﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Koonsoft.HYCRM.BLL;
using Koonsoft.HYCRM.Model;

public partial class Task_AllTasks : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int pageSize;

        if(ConfigurationManager.AppSettings["CompanyAuditPage"]!= null)
        {
            pageSize = Convert.ToInt32(ConfigurationManager.AppSettings["CompanyAuditPage"]);
        }
        else
        {
            pageSize = 20;
        }

        DataPager1.PageSize = pageSize;
    }

    /// <summary>
    /// 标记数据无效
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void MarkIneffective_OnCommand(Object sender, CommandEventArgs e)
    {
        string companySerialNumber = e.CommandArgument.ToString();

        if (!string.IsNullOrEmpty(companySerialNumber))
        {
            new CompanyBLL().UpdateCompanyStatus(companySerialNumber, (int)CompanyStatus.Ineffective);

            ListView1.DataBind(); 
        }
    }

    /// <summary>
    /// 指派给原分行
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void DesignateOwner_OnCommand(Object sender, CommandEventArgs e)
    {
        string companySerialNumber = e.CommandArgument.ToString();

        if (!string.IsNullOrEmpty(companySerialNumber))
        {
            new TasksBLL().AddNewTask(companySerialNumber);

            ListView1.DataBind();
        }
    }
}